<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%><%@ page
	language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Página de Anúncios</title>
<style>
.anuncios {
	border: solid 1px #ccc;
	padding: 10px;
	margin: 10px 0;
}
}
</style>
</head>
<body>
	<f:view>
		<h1>Página de Anúncios</h1>
		<div>
			<h:panelGrid border="0" columns="2"
				style="margin-top: 10px; margin-bottom: 10px;"
				rendered="#{!gerenciadorLogin.usuarioLogado }">
				<h:form>
					<h:commandLink action="login" style="margin-right: 10px">
						<h:outputText value="Efetuar login"></h:outputText>
					</h:commandLink>
				</h:form>
				<h:form>
					<h:commandLink action="cadastro">
						<h:outputText value="Realizar cadastro"></h:outputText>
					</h:commandLink>
				</h:form>
			</h:panelGrid>
			<h:outputText value="#{cadastro.msg}" style="color: #FF0000"></h:outputText>
			<h:form rendered="#{gerenciadorLogin.usuarioLogado }">
				<h:commandLink action="#{gerenciadorLogin.efetuarLogout}">
					<h:outputText value="Logout"></h:outputText>
				</h:commandLink>
			</h:form>
		</div>
		<div class="anuncios">
			<h:outputText
				value="Bem vindo #{gerenciadorLogin.usuario.nome}! Veja os nossos anúncios:"
				rendered="#{gerenciadorLogin.usuarioLogado}" style="font-weight: bold; margin-top: 10px; margin-bottom: 10px; display: block"></h:outputText>
			<h:dataTable border="1" rendered="#{not empty principal.listaAnuncios}"
				value="#{principal.listaAnuncios}" var="anuncio" style="width: 484px; ">
				<h:column id="column1">
					<h:outputText value="#{anuncio.titulo}" style="font-weight: bold; display: block; font-size: 14px; margin-top: 5px; margin-bottom: 5px; border-bottom-width: thin; border-bottom-style: solid; margin-left: 5px; margin-right: 5px"></h:outputText>
					<h:outputText value="#{anuncio.resumo}" style="display: block; margin-top: 5px; margin-bottom: 5px; margin-left: 5px; margin-right: 5px"></h:outputText>
					<h:form>
						<h:commandLink action="anuncio">
							<h:outputText value="+Ver detalhes" style="margin-left: 5px; margin-right: 5px"></h:outputText>
							<f:param value="#{anuncio.id}" id="anuncio" name="anuncio"></f:param>
						</h:commandLink>
					</h:form>
				</h:column>
			</h:dataTable>
			<h:outputText value="Nenhum anúncio disponível."
				rendered="#{empty principal.listaAnuncios}" style="display: block"></h:outputText>
		</div>
		<h:form rendered="#{gerenciadorLogin.usuarioLogado}" style="margin-top: 5px">
			<h:commandButton action="meusAnuncios" value="Gerenciar meus anúncios"></h:commandButton>
		</h:form>
	</f:view>
</body>
</html>